<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<title>班级学生管理界面</title>
		
			<script type="text/javascript">
				window.onload=function(){
					//登录失败提示
					var tips="<%=request.getParameter("parm1")%>"
					if(tips=='usernameErro'){
						var uValue = document.getElementById("tips").value="用户名错误!";
					}
					if(tips=='passwordErro'){
						var uValue = document.getElementById("tips").value="密码错误!!!";
					}
					
				
					//跳出主体框架
					if(window.parent != window){// 如果是在框架中
						//就让框架页面跳转到登陆页面
						window.parent.location.href = "http://localhost:8080/classStudentMS/login.jsp";
					}
					

				}
			</script>
			<script>
				//登录表单简单校验
				function checkLoginForm(){
					/**校验用户名,学号*/
					var uValue = document.getElementById("sid").value;
					if(uValue==""){
						//2.给出错误提示信息
						alert("用户名不能为空!");
						return false;
					}
					/*校验密码*/
					var pValue = document.getElementById("password").value;
					if(pValue==""){
						alert("密码不能为空!");
						return false;
					}
					
				}
			</script>
			
	</head>	
	<body style="background-color:#1D3647">
		<div align="center" style="margin:50px;">
			<form action="/classStudentMS/loginServlet" method="post" name="loginForm" onsubmit="return checkLoginForm()">
				<span style="color: purple; font-family: cursive; font-size: 23px; font-weight: bolder;">欢迎您进入班级学生管理系统 </span>
				<br/><br/>用户名：&nbsp;&nbsp;&nbsp;<input type="text" name="sid" id="sid" >
				<br/><br/>密 码： &nbsp;&nbsp;&nbsp;&nbsp;<input type="password" name="password" id="password"><br/><br/>
				<input type="text" id="tips" value="请登录或注册!" size="12"  style="color:#1EAA7C;background-color: #1D3647;border:none;margin-right:10px;"/>
				<input type="submit" class="button"  style="margin-right:20px;" value="登 陆">
				<input  type="button" class="button" id="cs" value="注册" onClick="window.location.href='${pageContext.request.contextPath}/regist.jsp'">
			</form>
		</div>
	</body>
</html>